package com.ruoyi.dl.controller.wechat;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dl.domain.DlNotice;
import com.ruoyi.dl.domain.DlUser;
import com.ruoyi.dl.service.IDlNoticeService;
import com.ruoyi.dl.service.IDlUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 用户消息Controller
 *
 * @author wangshouli
 * @date 2021-01-05
 */
@Controller
@RequestMapping("/wechat/dl/user")
@CrossOrigin(allowCredentials = "true")
public class WechatDlUserController extends BaseController {
    
    @Autowired
    private IDlUserService userService;

    /**
     * 查询所有公告
     *
     * @return
     */
    @PostMapping("/selectUser")
    @ResponseBody
    public AjaxResult selectUser(Integer userId) {
    	DlUser user = userService.selectDlUserById(userId);
    	System.out.println(userId);
        return AjaxResult.success("成功", user);
    }

    /**
     * 根据id查询公告明细
     *
     * @param noticeId id
     * @return
     */
    @PostMapping("/updateUser")
    @ResponseBody
    public AjaxResult updateUserById(DlUser user) {
        return AjaxResult.success("成功", userService.updateDlUser(user));
    }

}
